import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useCategoryStore = defineStore('category', () => {
  const categories = ref([
    { id: 'all', name: '全部' },
    { id: 'tech', name: '技术' },
    { id: 'career', name: '职场' },
    { id: 'life', name: '生活' }
  ])

  const currentCategory = ref('all')

  const setCategory = (id) => {
    currentCategory.value = id
  }

  return {
    categories,
    currentCategory,
    setCategory
  }
})